Repository navigation
fix(can_place_entity): allow offshore pumps on land at the shore (Factorio 2.0) - #434
Open
hashbender wants to merge 1 commit into
Open
hashbender wants to merge 1 commit into
hashbender wants to merge 1 commit into
Conversation
…torio 2.0) can_place_entity refused an offshore pump unless the tile at the position was water. In 2.0 the pump stands on land at the edge of water, so every valid spot was refused, while place_entity (which already searches land tiles next to water) placed the pump fine. Ask surface.can_place_entity instead, with the entity's direction, and say in the error that the pump goes at the edge of water. Update the manual line. Tests: test_can_place_offshore_pump_at_shore places a pump with place_entity, picks it up and checks can_place_entity accepts the same position. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
can_place_entity/server.luarefuses an offshore pump unless the tile at the position is water:In Factorio 2.0 an offshore pump stands on land at the edge of water. Its prototype collides with objects but not with water, and its
tile_buildability_rulesrequire water in front of it. So the tile under a valid pump is sand, grass or dirt. A scan along one shore found 23 valid placements on land and none on water.can_place_entity(Prototype.OffshorePump, ...)therefore returnsFalsefor every spot where the pump can actually go. Meanwhileplace_entity, which already searches for a land tile next to water, places it without trouble. The manual adds to the confusion by saying "Offshore pumps require water tiles".Fix
can_place_entity/server.lua: drop the water-tile test and asksurface.can_place_entitywith the entity's direction. When the game says no, the error now reads "it must be placed at the edge of water". The general collision check and the existingavoid_entitycheck are unchanged.can_place_entity/agent.md: "Offshore pumps are placed on land at the edge of water (Factorio 2.0), not on water tiles".Testing
test_can_place_offshore_pump_at_shoreintests/actions/test_can_place.py: places a pump at the nearest water withplace_entity, picks it up, and checks thatcan_place_entityaccepts the same position in at least one direction. It needs a server and is left to thefactorio-testworkflow; I haven't run it. OnmainI'd expect it to fail with "lack of water".luac -pparses the changed Lua. ruff 0.11.13 and prettier are clean.🤖 Generated with Claude Code